Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: guard against state-modifying expressions in range expression #3546

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

tserg
Copy link
Collaborator

@tserg tserg commented Aug 3, 2023

What I did

Fix #3504, fix #3172, closes #3188.

How I did it

Check for state modifying expressions in a range expression, and validate that no expression modifies state.

How to verify it

See new tests.

Commit message

fix: guard against state-modifying expressions in `range` expression

Description for the changelog

Guard against state-modifying expressions in range expression

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2023

Codecov Report

Merging #3546 (1d214ee) into master (cfda16c) will decrease coverage by 2.43%.
Report is 5 commits behind head on master.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3546      +/-   ##
==========================================
- Coverage   89.11%   86.68%   -2.43%     
==========================================
  Files          85       85              
  Lines       11362    11369       +7     
  Branches     2584     2586       +2     
==========================================
- Hits        10125     9855     -270     
- Misses        816     1059     +243     
- Partials      421      455      +34     
Files Changed Coverage Δ
vyper/semantics/analysis/local.py 91.78% <100.00%> (+0.16%) ⬆️

... and 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@tserg tserg changed the title fix: guard against state-modifying function calls in range expression fix: guard against state-modifying expressions in range expression Aug 5, 2023
Comment on lines 411 to 416
disallowed_builtins = (
"raw_call",
"create_minimal_proxy_to",
"create_copy_of",
"create_from_blueprint",
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a better option is to add the is_modifying attribute from member functions to builtins, which would allow us to check both member functions and builtin functions at the same time. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants